package com.zlc.common.core.process.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zlc.common.common.service.BaseServiceImpl;
import com.zlc.common.core.process.mapper.StoneTaskHistoryMapper;
import com.zlc.common.core.process.model.entity.StoneTaskHistory;
import com.zlc.common.core.process.model.vo.StoneTaskHistoryVo;
import com.zlc.common.core.process.service.StoneTaskHistoryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author  zl
 * @date 2023-10-17 
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class StoneTaskHistoryServiceImpl extends BaseServiceImpl<StoneTaskHistoryMapper, StoneTaskHistory, StoneTaskHistoryVo> implements StoneTaskHistoryService{

    @Override
    public StoneTaskHistoryVo getByTaskId(String taskId) {
        LambdaQueryWrapper<StoneTaskHistory> wrapper = wrapper().eq(StoneTaskHistory::getTaskId, taskId);
        return queryOne(wrapper);
    }

    @Override
    public List<StoneTaskHistoryVo> getByProcessInstanceId(String processInstanceId) {
        LambdaQueryWrapper<StoneTaskHistory> wrapper = wrapper()
                .eq(StoneTaskHistory::getProcessInstanceId, processInstanceId)
                .orderByAsc(StoneTaskHistory::getCreateTime);
        return queryVoList(wrapper);
    }

}
